import { createApp } from 'vue'
import App from './App.vue'

// 导入css样式
import 'normalize.css'
import './assets/css/index.less'

// 导入路由和vuex
import router from './router'
import store from './store'

// 导入element plus
import { registerApp } from './global'

// 导入封装后的axios请求对象
import myRequest from './service'

interface DataType {
  data: any
  returnCode: string
  success: boolean
}
myRequest
  .get<DataType>({
    url: '/home/multidata',
    showLoading: true,
    interceptors: {
      requestInterceptor: (config) => {
        // console.log('单独请求的config')
        return config
      },
      responseInterceptor: (res) => {
        // console.log('单独响应的res')
        return res
      }
    }
  })
  .then((res) => {
    console.log(res.data)
    console.log(res.success)
    console.log(res.returnCode)
  })

// 注册vue实例
const app = createApp(App)

// 挂载路由和vuex
app.use(router)
app.use(store)

// 把element plus注册成全局组件
registerApp(app)

// 挂载vue实例
app.mount('#app')
